import * as React from 'react'
import ReactDOM from 'react-dom'
import './assets/frame/tree'
import RedBox from 'redbox-react'
const urlHelp = require('./config/urlHelp');
//  ok
// import TEST from './assets/modules/Tabs_Demo/Tabs_Demo'  
// import TEST from './assets/modules/ListDemo/ListDemo'//列表 
// import TEST from './assets/modules/MenuGridLayout/MenuGridLayout'// 菜单 
// import TEST from './assets/modules/TimeDemo/TimeDemo'//时间 
//  import TEST from './assets/modules/StepLoadTableDemo/StepLoadTableDemo'// Table 
// import TEST from './assets/modules/ResponsivePopup/ResponsivePopup'//弹窗
// import TEST from './assets/modules/TreesDemo/TreesDemo'//节点树 
// import TEST from './assets/modules/Chat/Chat'// 聊天对话
// import TEST from './assets/modules/LnstantMesList/LnstantMesList'// 
// import TEST from './assets/modules/Breadcrumb_Demo/Breadcrumb_Demo'// 面包屑
// import TEST from './assets/modules/Calendar_demo/Calendar_demo'// 日历
// import TEST from './assets/modules/Demo_ListDeal/Demo_ListDeal'// Demo_ListDeal
// import TEST from './assets/modules/Demo_datepicker/Demo_datepicker'// 时间插件
// import TEST from './assets/modules/IsosurfaceDemo/IsosurfaceDemo'// 等值面信息





// import TEST from './assets/modules/ApplicationForm/ApplicationForm'// 申请单
// import TEST from './assets/modules/Weather/Weather'// 气象 天气 


// import TEST from './assets/modules/Contacts/Contacts'// 通讯录
// import TEST from './assets/modules/Position_Picker/Position_Picker' // 拖拽选址
// import TEST from './assets/modules/Test_GXT/Test_GXT'   //echarts 代码API  
// import TEST from './assets/modules/Flood_Duty/Flood_Duty'//防汛值班
// import TEST from './assets/modules/Emergency_support/Emergency_support'  //应急响应----zch 
// import TEST from './assets/modules/RelationGraph/RelationGraph'//组织机构 模块 lzz
// import TEST from './assets/modules/MainShow/MainShow'// 首页
import TEST from './assets/modules/Fh_zbgl/Fh_zbgl'// 
 
 
//url 预处理
const inject = (conf) => {
    if(!conf.key){
        return;
    }
    let basePath = (urlHelp.isReal) ? urlHelp.real[conf.key] : urlHelp.simulation[conf.key];
    if(conf.method == 'POST') {
        conf.url = basePath;
    }else{
        let theRequest = new Object();  
        if (basePath.indexOf("?") !== -1) {
            let str = basePath.substr(basePath.indexOf("?") + 1);   
            let strs = str.split("&");   
            for(let i = 0; i < strs.length; i ++) {   
                theRequest[strs[i].split("=")[0]] = strs[i].split("=")[1];   
            }
            basePath = basePath.substring(0,basePath.indexOf("?"));
        }
        theRequest = (urlHelp.isReal) ? Object.assign({},theRequest,conf.data) : Object.assign({},conf.data,theRequest);
        conf.data = theRequest;
        conf.url = basePath;
    }
}

// T 全局配置
let config = {
  router: {
      go: '/',//默认路由（当前路由为空时跳转）
      route: {
          path: '/'
      }
  },  
  data:{},
  ajax: {
    inject : inject
  }
}
T.config(config)
const MOUNT_NODE = document.getElementById('root')

try {
    ReactDOM.render(<TEST />, MOUNT_NODE)
} catch (e) {
    ReactDOM.render(<RedBox error={e} />, MOUNT_NODE)
}
